#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "AD.h"
//#include "OLED_Font.h"
//4-1 OLED显示屏
uint16_t Num;
uint16_t Voltage;
int main(void){
	OLED_Init();
	AD_Init();
	OLED_ShowString(1,1,"ADValue:");\
	OLED_ShowString(2,1,"Voltage:0.00V");
	while(1){
		Num=ADC_Get();
		Voltage=(float)ADC_Get()/4095*3.3;//因为ADC是12位，所以需要除以它的存储最大值4095
		OLED_ShowNum(1,9,Num,4);
		//OLED.h中并没有对浮点数的输出，所以进行替换
		OLED_ShowNum(2,9,Voltage,1);
		OLED_ShowNum(2,11,(uint16_t)(Voltage*100)%100,2); //浮点数不能取余，需要转类型
		
		Delay_ms(100);
	}
}
